import copy


def f1():
    """直接赋值"""
    x = [1, 2, [3, 4]]
    y = x
    y.append(99)
    y[2].append(5)
    print("x: {0}\ny: {1}".format(x, y))


def f2():
    """浅拷贝"""
    x = [1, 2, [3, 4]]
    y = copy.copy(x)
    y.append(99)
    y[2].append(5)
    print("x: {0}\ny: {1}".format(x, y))


def f3():
    """深拷贝"""
    x = [1, 2, [3, 4]]
    y = copy.deepcopy(x)
    y.append(99)
    y[2].append(5)
    print("x: {0}\ny: {1}".format(x, y))


print("--- 直接赋值 ---")
f1()
print("--- 浅拷贝 ---")
f2()
print("--- 深拷贝 ---")
f3()
